﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinformToolkit.Navigations
{
    /// <summary>
    /// 与JSON配置文件对应的对象
    /// </summary>
    public class WFMenuItem
    {
        /// <summary>
        /// 菜单ID
        /// </summary>
        [JsonProperty("id")]
        public string ID { get; set; }

        /// <summary>
        /// 菜单的名字
        /// </summary>
        [JsonProperty("name")]
        public string Name { get; set; }

        /// <summary>
        /// 该菜单所对应的图标
        /// </summary>
        [JsonProperty("icon")]
        public string Icon { get; set; }

        /// <summary>
        /// 菜单所对应的内容页面的入口类名
        /// </summary>
        [JsonProperty("entryClass")]
        public string EntryClass { get; set; }

        /// <summary>
        /// 用户自定义的数据
        /// </summary>
        [JsonProperty("userData")]
        public Dictionary<string, object> UserData { get; set; }

        /// <summary>
        /// 内容页面实例
        /// </summary>
        [JsonIgnore]
        internal IContentControl Content { get; set; }

        /// <summary>
        /// 页面是否初始化了
        /// </summary>
        [JsonIgnore]
        internal bool IsInitialized { get; set; }

        public WFMenuItem()
        {
            this.UserData = new Dictionary<string, object>();
        }

        public override string ToString()
        {
            return this.Name;
        }
    }
}
